#!/bin/sh

if type gdb 2>/dev/null; then
    cmd=$1
    shift
    c=""; for i in `seq 1 $#`; do c="$c \"$1\""; shift; done
    gdb $cmd <<EOF
handle SIGPIPE nostop pass noprint
handle SIG32   nostop pass noprint
handle SIGUSR1 nostop pass noprint
handle SIGUSR2 nostop pass noprint
r $c
bt
EOF
else
    $*
fi
